import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)
export const router = [
  {
    path: '/',
    name: 'home',
    base: '/app/',
    component: () => import('@/views/home/index'), // 路由懒加载
    meta: {
      title: '首页', // 页面标题
      keepAlive: false // keep-alive 标识
    }
  },
  // {
  //   path: '/',
  //   name: 'auth',
  //   component: () => import('@/views/auth/index'), // 路由懒加载
  //   meta: {
  //     title: '登录', // 页面标题
  //     keepAlive: false // keep-alive 标识
  //   }
  // },
  {
    path: '/about',
    name: 'about',
    component: () => import('@/views/home/about'),
    meta: {
      title: '关于我',
      keepAlive: false
    }
  },
  {
    path: '/details',
    name: 'details',
    component: () => import('@/views/home/details/index.vue'),
    meta: {
      title: '油站详情'
    }
  },
  {
    path: '/oilDetails',
    name: 'oilDetails',
    component: () => import('@/components/oilDetails/index.vue'),
    meta: {
      title: '订单详情'
    }
  },
  {
    path: '/sub',
    name: 'sub',
    component: () => import('@/views/sub/index.vue'),
    meta: {
      title: '订单提交'
    }
  },
  {
    path: '/phone',
    name: 'phone',
    component: () => import('@/views/phone/index.vue'),
    meta: {
      title: '填写手机号'
    }
  }
]

const createRouter = () =>
  new Router({
    mode: 'hash', // 如果你是 history模式 需要配置vue.config.js publicPath
    // base: '/app/',
    scrollBehavior: () => ({y: 0}),
    routes: router
  })

export default createRouter()
